#-*- encoding:utf8 -*-
import requests
import json


def getCameraTemp(api_url,
                  xmin,
                  ymin,
                  xmax,
                  ymax):


    data = json.dumps({'type':2, 'points':[{"x":xmin,"y":ymin},{"x":xmax,"y":ymax}]})
    response = requests.post(api_url, data=data)
    result = response.text
    result = json.loads(result)
    print(result)
    print('坐标信息%d,%d,%d,%d,当前最高温度:%s' % (xmin, ymin, xmax, ymax, str(result["maxTemp"] * 0.001)))
    return result["maxTemp"] * 0.001
    #return 35

if __name__ == "__main__":
    result = getCameraTemp(api_url = 'http://192.168.20.65/api/v1/temp', xmin=10, ymin=10, xmax=12, ymax=12)
    print(result)
